<template>
  <div class="layout-header-container">
    <div class="layout-header-left">
      <img class="layout-header-left-img" src="../../assets/logo.png" alt="Logo" />
      <h4 class="layout-header-left-title ml-3">商城后台管理系统</h4>
    </div>
    <div class="layout-header-right">
      <button type="button" class="btn btn-light" @click="onLogout">退出</button>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router';

const router = useRouter();

const onLogout = () => {
  // 移除本地存储中的 token
  localStorage.removeItem('token');
  // 跳转到登录页面
  router.push('/login');
};
</script>